<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>商户系统 - </title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="icon" id="mainSiteIcon" type="image/x-icon" />
  <link rel="stylesheet" href="layui/css/layui.css" media="all">
  <script>
    /^http(s*):\/\//.test(location.href) || alert('请先部署到 localhost 下再访问');
  </script>
</head>
<body>
<div id="LAY_app"></div>
<script src="layui/layui.js"></script>
<script>
  layui.config({
    base: '../src/' //指定 layuiAdmin 项目路径，本地开发用 src，线上用 dist
    ,version: '1.0.36'
  }).use('index', function(){

      //同步请求后台，查询站点标题 (由于采用单页模式， 登录、执行业务操作，仅仅执行一次该函数，除非刷新浏览器访问该页面)
      //如果采取localStorage 判断缓存机制，会导致后台更新后由于localStorage不删除导致无法及时更新的问题。
      layui.$.ajax({
          async: false, type: 'get',
          url: layui.setter.baseUrl + '/auth/siteTitle',
          success: function(res){
              var siteInfo = res.data ? res.data : "";
              layui.data(layui.setter.tableName, { //放置到localStorage
                  key: 'siteInfo' ,value: siteInfo
              });
              layui.$('title').append(res.data.siteTitle);

              let siteIcon = res.data.siteIcon;
              if(siteIcon.startsWith("http://") || siteIcon.startsWith("https://")){
                layui.$("#mainSiteIcon")[0].href = siteIcon;
              }else{
                layui.$("#mainSiteIcon")[0].href = window.location.origin + siteIcon;
              }
          }
      });
  });
</script>
</body>
</html>



